home *** CD-ROM | disk | FTP | other *** search
/ PD ROM 1 / PD ROM Volume I - Macintosh Software from BMUG (1988).iso / Stacks / Hyper Education / Library Hyper Card Templates / Open Stack / Circulation / stack.txt < prev   
Encoding:
Text File  |  1987-12-04  |  14.7 KB  |  359 lines

  1. -- stack: in
  2. -- format: 8 (HyperCard 1)
  3. -- flags: 0x0 (none)
  4. -- protect password hash: 0
  5. -- maximum user level: 5 (scripting)
  6. -- window: Rect(x1=0, y1=0, x2=0, y2=0)
  7. -- screen: Rect(x1=0, y1=0, x2=0, y2=0)
  8. -- card dimensions: w=0 h=0
  9. -- scroll: x=0 y=0
  10. -- background count: 1
  11. -- first background id: 2593
  12. -- card count: 2
  13. -- first card id: 3290
  14. -- list block id: 2134
  15. -- print block id: 3429
  16. -- font table block id: 0
  17. -- style table block id: 0
  18. -- free block count: 5
  19. -- free size: 30848 bytes
  20. -- total size: 90112 bytes
  21. -- stack block size: 13824 bytes
  22. -- created by hypercard version: 0x00000000
  23. -- compacted by hypercard version: 0x00000000
  24. -- modified by hypercard version: 0x00000000
  25. -- opened by hypercard version: 0x00000000
  26. -- patterns[0]: 0x0000000000000000
  27. -- patterns[1]: 0x0000220000002200
  28. -- patterns[2]: 0x8800220088002200
  29. -- patterns[3]: 0xCC003300CC003300
  30. -- patterns[4]: 0xCC883322CC883322
  31. -- patterns[5]: 0xEE88BB22EE88BB22
  32. -- patterns[6]: 0xEECCBB33EECCBB33
  33. -- patterns[7]: 0xFFCCFF33FFCCFF33
  34. -- patterns[8]: 0xFFEEFFBBFFEEFFBB
  35. -- patterns[9]: 0xFFFFFFBBFFFFFFBB
  36. -- patterns[10]: 0x8010022001084004
  37. -- patterns[11]: 0xFFFFFFFFFFFFFFFF
  38. -- patterns[12]: 0x8822882288228822
  39. -- patterns[13]: 0x1122448811224488
  40. -- patterns[14]: 0xC4800C6843023026
  41. -- patterns[15]: 0xB130031BD8C00C8D
  42. -- patterns[16]: 0xAA00AA00AA00AA00
  43. -- patterns[17]: 0x8822552288225522
  44. -- patterns[18]: 0x8855225588552255
  45. -- patterns[19]: 0x77DD77DD77DD77DD
  46. -- patterns[20]: 0x8000000000000000
  47. -- patterns[21]: 0xAA55AA55AA55AA55
  48. -- patterns[22]: 0x038448300C020101
  49. -- patterns[23]: 0x8244394482010101
  50. -- patterns[24]: 0x8814224188412214
  51. -- patterns[25]: 0x8080413E080814E3
  52. -- patterns[26]: 0x22048C7422179810
  53. -- patterns[27]: 0xBE808808EB088880
  54. -- patterns[28]: 0x25C8328964244C92
  55. -- patterns[29]: 0xA29C41BE2AC914EB
  56. -- patterns[30]: 0x40A00000040A0000
  57. -- patterns[31]: 0x8040200002040800
  58. -- patterns[32]: 0xAA00800088008000
  59. -- patterns[33]: 0xFF80808080808080
  60. -- patterns[34]: 0x081C22C180010204
  61. -- patterns[35]: 0xFF808080FF080808
  62. -- patterns[36]: 0xF87422478F172271
  63. -- patterns[37]: 0xBF00BFBFB0B0B0B0
  64. -- patterns[38]: 0xFF7FBE5DA2418000
  65. -- patterns[39]: 0xFAF5FAF5A050A050
  66. -- checksum: 0x0
  67. ----- HyperTalk script -----
  68. ---------------------- Open Stack‚Ñ¢ Copyright 1987-----------------------
  69. ---------------------- by the Walking Shadow Press ---------------------
  70. on startUp
  71.   getHomeInfo
  72.   global fieldScript,fieldList,bookNumber,autoNumbering
  73.   global tentativeBook, initGlobals
  74.   ------------------------------------------------------------------
  75.   --  fieldScript is a global which contains the script that is   --
  76.   --  automatically loaded into each newly created field.         --
  77.   --  The field must be named at the time of creation in order    --
  78.   --  for fieldScript to be loaded into its script.  Otherwise,   --
  79.   --  errors result.                                              --
  80.   --                                                              --
  81.   --                                                              --
  82.   --  The following put commands put the generic field script     --
  83.   --  into global fieldScript.                                    --
  84.   ------------------------------------------------------------------
  85.   put empty into fieldScript
  86.   put "on closeField" into line 1 of fieldScript
  87.   put "global fieldList" into line 2 of fieldScript
  88.   put "put word 3 of name of me into tempName" into line 3 of fieldScript
  89.   put "if not(fieldList contains tempName) then" into line 4 of fieldScript
  90.   put "put (word 3 of name of me) & ""e&",""e&" after fieldList" into line 5 of fieldScript
  91.   put "end if" into line 6 of fieldScript
  92.   put "end closeField" into line 7 of fieldScript
  93.  
  94.   ---------------------------------------------------------------------
  95.   --  fieldList is the global whick keeps track of which fields are  --
  96.   --  altered and need to be replicated each time a card is opened   --
  97.   --  and then closed.                                               --
  98.   ---------------------------------------------------------------------
  99.   put empty into fieldList
  100.   ---------------------------------------------------------------------
  101.   --  tentativeBook is a global which records whether a new card is  --
  102.   --  being tentatively numbered, awaiting the entry of book data.   --
  103.   ---------------------------------------------------------------------
  104.   put false into tentativeBook
  105.  
  106.   --------------------------------------------------------------------
  107.   -- The automatic book numbering feature uses the globals:         --
  108.   -- autoNumbering and bookNumber to record whether autonumbering   --
  109.   -- is currently turned on and the next book number, respectively. --
  110.   -- They must be initialized on startUp by going to the control    --
  111.   -- card and accessing the "Book Number" field and the             --
  112.   -- autoNumbering button.                                          --
  113.   --------------------------------------------------------------------
  114.   set lockScreen to true
  115.   push card
  116.   put true into initGlobals
  117.   go to stack "Control"
  118.   put the hilite of button "Auto Numbering" into autoNumbering
  119.   put card field "Book Number" into bookNumber
  120.   ----------------------------------------------------------------
  121.   -- initGlobals records whether the globals have already been  --
  122.   -- initialized or not.  Otherwise, upon entry to the control  --
  123.   -- card, the "Book Number" field would be set to the current  --
  124.   -- value of global bookNumber, which is at first empty.       --
  125.   ----------------------------------------------------------------
  126.   put false into initGlobals
  127.   pop card
  128.   set lockScreen to false
  129.  
  130.   pass startUp
  131. end startUp
  132.  
  133. on openStack
  134.   global beginGlobal
  135.   -----------------------------------------------------------------
  136.   --  This stack might be opened directly, which means that the  --
  137.   --  globals may not be initialized yet.  beginGlobal will      --
  138.   --  always be false if the library system is up already.       --
  139.   --  Otherwise, a startUp message is send to initialize the     --
  140.   --  globals.                                                   --
  141.   -----------------------------------------------------------------
  142.   if beginGlobal is not false then
  143.     put false into beginGlobal
  144.     set cursor to 4
  145.     startUp
  146.   end if
  147. end openStack
  148.  
  149. on quit
  150.   global bookNumber
  151.   -----------------------------------------------------------
  152.   -- on quit we should save the bookNumber global so its   --
  153.   -- current value will be available upon startUp later.   --
  154.   -- bookNumber is saved in the "Book Number" field on the --
  155.   -- conrtol card.                                         --
  156.   -----------------------------------------------------------
  157.   set lockScreen to true
  158.   push card
  159.   go to stack "Control"
  160.   put bookNumber into card field "Book Number"
  161.   pop card
  162.   set lockScreen to false
  163. end quit
  164.  
  165. on mkNewCard
  166.   global autoNumbering
  167.   ---------------------------------------------------------------------
  168.   --  This handler coordinates the creation of a new card set        --
  169.   --  record.  It does so by going to each of the four main stacks:  --
  170.   --  Acquisition, Circulation, Catalog, and Label Setup and         --
  171.   --  making a new card on each.                                     --
  172.   --      At the same time the cards are made, their id numbers are  --
  173.   --  noted and from all four id numbers is created the card script  --
  174.   --  which controls the transfer to the related cards of each stack.--
  175.   ---------------------------------------------------------------------
  176.   set cursor to 4
  177.   -- First, we create a new card in the current stack. --
  178.   doMenu "New Card"
  179.   set lockScreen to true
  180.  
  181.   -- We record the id of the newly created card in circId.  --
  182.   put the id of this card into circId
  183.  
  184.   -------------------------------------------------------------------
  185.   -- Next, we create a segment of what will eventually be the      --
  186.   -- card script of each new card.  The following segment will     --
  187.   -- handle transfers from other stacks to the card just created.  --
  188.   -------------------------------------------------------------------
  189.   put "on goCirc" into line 1 of goCircScr
  190.   put "go to "&circId&" of stack Circulation" into line 2 of goCircScr
  191.   put "end goCirc" into line 3 of goCircScr
  192.   ---------------------------------------------------------------------
  193.   -- We push this card, 'cause we'll be coming back. See the second  --
  194.   -- to the last comment in this handler.                            --
  195.   ---------------------------------------------------------------------
  196.   push card
  197.   ---------------------------------------------------------------------
  198.   --  We next go to the Acquisition stack and do the same operations --
  199.   --  as above, then go to the Catalog stack, and then the Label     --
  200.   --  Setup stack below...                                           --
  201.   ---------------------------------------------------------------------
  202.   go to stack "Acquisitions"
  203.   doMenu "New Card"
  204.  
  205.   put the id of this card into acqId
  206.  
  207.   put "on goAcq" into line 1 of goAcqScr
  208.   put "go to "&acqId&" of stack Acquisitions" into line 2 of goAcqScr
  209.   put "end goAcq" into line 3 of goAcqScr
  210.   push card
  211.   ------------------------------------------------------------------
  212.   go to stack "Cataloging" -- See last comment.
  213.   doMenu "New Card"
  214.  
  215.   put the id of this card into catId
  216.  
  217.   put "on goCat" into line 1 of goCatScr
  218.   put "go to "&catId&" of stack Cataloging" into line 2 of goCatScr
  219.   put "end goCat" into line 3 of goCatScr
  220.   push card
  221.   ------------------------------------------------------------------
  222.   go to stack "Labels" -- See last big comment.
  223.   doMenu "New Card"
  224.  
  225.   put the id of this card into labId
  226.  
  227.   put "on goLab" into line 1 of goLabScr
  228.   put "go to "&labId&" of stack Labels" into line 2 of goLabScr
  229.   put "end goLab" into line 3 of goLabScr
  230.   ------------------------------------------------------------------
  231.   -- Now, from all the card script segments created above, we     --
  232.   -- synthesize a big card script that will handle inter-stack    --
  233.   -- transfers.  We combine all the segments into the variable    --
  234.   -- cardScr.                                                     --
  235.   ------------------------------------------------------------------
  236.   put goAcqScr into cardScr
  237.   put goCircScr into line 4 of cardScr
  238.   put goCatScr into line 7 of cardScr
  239.   put goLabScr into line 10 of cardScr
  240.  
  241.   -------------------------------------------------------------------
  242.   --  Finally, since we've been "pushing" cards as we went along,  --
  243.   --  all we do now is retrace our card steps by "popping" and     --
  244.   --  set the card scripts of each card we created to the          --
  245.   --  synthesized script.                                          --
  246.   -------------------------------------------------------------------
  247.   set the script of this card to cardScr
  248.   pop card
  249.   set the script of this card to cardScr
  250.   pop card
  251.   set the script of this card to cardScr
  252.   pop card
  253.   set the script of this card to cardScr
  254.  
  255.   --------------------------------------------------------------------
  256.   --  Look at the openCard handler in the background script.  You   --
  257.   --  will notice that the auto-numbering function is deactivated   --
  258.   --  if the card's script is emtpy.  This is done to prevent       --
  259.   --  autonumbering while the cards are created.                    --
  260.   --  Now, however, we want the auto-numbering function to work,    --
  261.   --  provided it's been turned on, so we send an openCard          --
  262.   --  message to the current card.                                  --
  263.   --------------------------------------------------------------------
  264.   if autoNumbering is true then send openCard to this card
  265.  
  266.   set lockscreen to false
  267. end mkNewCard
  268.  
  269. on delCard
  270.   ---------------------------------------------------------------------
  271.   --  This handler coordinates the deletion of card sets             --
  272.   --  It does so by going to each of the four main stacks:           --
  273.   --  Acquisition, Circulation, Catalog, and Label Setup and         --
  274.   --  deleting the right card in each.                               --
  275.   --  To make sure the right card is deleted, we use the             --
  276.   --  go to command that appears in the card script, which is the    --
  277.   --  same command that normally transfers to other cards from       --
  278.   --  the current one.                                               --
  279.   ---------------------------------------------------------------------
  280.   if the number of cards >1 then
  281.     answer "Delete this and related cards in other stacks?" with "OK" or "Cancel"
  282.     if it is not "Cancel" then
  283.       set cursor to 4
  284.       set lockScreen to true
  285.  
  286.       push card
  287.       do line 2 of the script of this card -- go to Acquisition
  288.       --------------------------------------------------------------
  289.       -- Unfortunately, we cannot delete immediately, else        --
  290.       -- we lose our way to the other cards, so push this card... --
  291.       --------------------------------------------------------------
  292.       push card
  293.       do line 8 of the script of this card -- go to Catalog
  294.       push card -- Push the catalog card too.
  295.       do line 11 of the script of this card -- go to Label SetUp
  296.       --------------------------------------------------------------
  297.       --  Now that we have all the related cards nicely lined     --
  298.       --  up in the card id stack, we just delete and pop, delete --
  299.       --  and pop ... etc.                                        --
  300.       --------------------------------------------------------------
  301.       doMenu "Delete Card"
  302.       pop card
  303.       doMenu "Delete Card"
  304.       pop card
  305.       doMenu "Delete Card"
  306.       pop card
  307.       doMenu "Delete Card"
  308.  
  309.       set lockscreen to false
  310.     end if
  311.   else
  312.     answer "The last card cannot be deleted."
  313.   end if
  314. end delCard
  315.  
  316. on arrowKey whichKey
  317.   --------------------------------------------------------------
  318.   -- If the keyboard has arrow, we make use of some to go to  --
  319.   -- next and previous cards...                               --
  320.   --------------------------------------------------------------
  321.   if the CommandKey is down then
  322.     mkNewCard
  323.   else
  324.     if whichKey = "right" then
  325.       go to next card
  326.     else
  327.       if whichKey = "left" then
  328.         go to prev card
  329.       end if
  330.     end if
  331.   end if
  332. end arrowKey
  333.  
  334. -------------------- End Walking Shadow Library ---------------------
  335.  
  336. on resume
  337.   getHomeInfo
  338.   pass resume
  339. end resume
  340.  
  341. on getHomeInfo
  342.   global stacks,applications,documents,userName
  343.   set lockScreen to true
  344.   set lockMessages to true
  345.   push this card
  346.   go to card "User Preferences" of stack "Home"
  347.   put card field "User Name" into userName
  348.   set userLevel to card field "User Level"
  349.   set powerKeys to the hilite of button "Power Keys"
  350.   set blindTyping to the hilite of button "Blind Typing"
  351.   put field "paths" of card "stacks" into stacks
  352.   put field "paths" of card "applications" into applications
  353.   put field "paths" of card "documents" into documents
  354.   pop card
  355.   set lockScreen to false
  356.   set lockMessages to false
  357. end getHomeInfo
  358.  
  359.